#include "OurKickInBehaviour.h"

// Cas, ktory caka hrac s loptou pre nabiehanie si spoluhracov
#define WAIT_TIMEOUT 30

extern CEvaluatingPlayerList* ePlayerList;

// <Vhadzovanie>
void OurKickInBehaviour::Behave()
{
	Point tmpPoint = world->me->pos;
	tmpPoint.SetX(tmpPoint.GetX() + 5);

	// Vhadzujem v hornej casti ihriska 
	if(tmpPoint.GetY() < 0)
		tmpPoint.SetY(tmpPoint.GetY() + 15);

	// Vhadzujem v spodnej casti ihriska
	else
		tmpPoint.SetY(tmpPoint.GetY() - 15);

	if(DATA_STORAGE.kickInModeDuration++ < WAIT_TIMEOUT)
	{	
		if((DATA_STORAGE.kickInModeDuration == 1) && (!world->me->IsLookingAt(tmpPoint)))
		{
			world->me->bNeckSynchronization = false;
			GetTurnToBehaviour()->Behave(tmpPoint);
			return;
		}	
		else
		{
			return;
		}
	}

	//BK - nove spravanie, rozohravka vlasnemu spoluhracovi
	GetStartPlayOnByPassToOurPlayerBehaviour()->Behave();
	return;
}

